package org.example.rmsmsapi.common;

import lombok.Data;

@Data
public class Result<T> {

    private String resultCode;
    private String message;
    private T data;

    public static <T> Result<T> success(T data) {
        Result<T> result = new Result<>();
        result.resultCode ="0";
        result.message = "操作成功";
        result.data = data;
        return result;
    }

    public static <T> Result<T> success() {
        Result<T> result = new Result<>();
        result.resultCode ="0";
        result.message = "操作成功";
        return result;
    }

    public static <T> Result<T> error(String code, String message) {
        Result<T> result = new Result<>();
        result.resultCode = code;
        result.message = message;
        return result;
    }

    public static <T> Result<T> error(String message) {
        Result<T> result = new Result<>();
        result.resultCode = "1";
        result.message = message;
        return result;
    }
}    